package com.heima.client;

import com.heima.client.config.WmFeignConfig;
import com.heima.client.fallback.ArticleFeignImpl;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient(value = "leadnews-article",
        fallbackFactory = ArticleFeignImpl.class,
        configuration = WmFeignConfig.class)
public interface ArticleFeign {

    @GetMapping("/article/api/v1/author/findByUserId/{id}")
    ResponseResult findAuthorByUserId(@PathVariable Integer id);

    @PostMapping("/article/api/v1/author/save")
    ResponseResult saveAuthor(@RequestBody ApAuthor apAuthor);


    // 新增
    // =================新增接口=====================
    @PostMapping("/api/v1/article/save")
    ResponseResult saveArticle(@RequestBody ArticleDto articleDto);
}
